package com.byComputer.bo;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import com.byComputer.util.HbnUtil;
import com.byComputer.vo.Computer;

/**
 * @购物车：包含了很多的购物票
 * @author WangPeihu
 * 
 */
public class Cart {

	/** 一个cart包含了若干了购买了的东西小票 */
	private List<CartItem> items;

	public void addItem(int computerId) {
		Session s = HbnUtil.getSession();
		String hql = "from Computer c where c.id=" + computerId;
		Query query = s.createQuery(hql);
		Computer computer = (Computer) query.uniqueResult();

		s.close();
	}

	public void removeItem(int computerId) {

	}

	public void updateItem(int computerId, int newNumber) {

	}

	public void clear() {
		items.clear();
	}

	public List<CartItem> getItems() {
		return this.items;
	}

	public void setItems(List<CartItem> items) {
		this.items = items;
	}
}
